<?

$tmppath="../../";
REQUIRE ($tmppath."include/login.php");
REQUIRE ($tmppath."templates/default/up.php");
REQUIRE($tmppath."protect/connect_jeu.php");
REQUIRE("../fonction.php");
$PAGE=NULL;$SELECTED=NULL;
$titre="Envoyer un message";
$PAGE.=TITRE($titre);










//Si il envoye un message directement via la carte
//------------------------------------------------
IF (!empty($pseudo) && $pseudo!=$_USER_PERSO) {
           $query    = "INSERT INTO sdconns (conn_joueur,conn_seigneur) VALUES ($_PERSO_ID,'$pseudo')";
           $resultat = mysql_query($query);
           
           $SELECTED[$pseudo]="selected";


}



$query="SELECT C.conn_seigneur,P.perso_name FROM sdconns AS C, sduser_perso AS P WHERE C.conn_seigneur=P.perso_id AND C.conn_joueur=$_USER_PERSO ORDER BY P.perso_name";
$resultat=mysql_query($query);


 mysql_close();

$PAGE.="<div></div><CENTER>

<table width=\"95%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\"  CLASS=\"fondblack\">
  <tr>
    <td CLASS=\"TD1\" valign=\"top\">


          

    <CENTER>
        <form name=\"form1\" method=\"POST\" action=\"messagerie_test.php\">
         <div><font CLASS=\"petit_ville\">Destinataire</font></div> <select name=\"perso[]\" multiple=\"multiple\" size=\"20\">";


     WHILE ($name=mysql_fetch_array($resultat)){
             $PAGE.="<option value=\"$name[0]\"  ".$SELECTED[$name[0]].">$name[1]</option>";
     }//Fin du WHILE ($name=mysql_fetch_array($resultat)){



$PAGE.="</select></CENTER>";
$PAGE.="</td><td CLASS=\"TD1\"><CENTER>";
          
$PAGE.="<font CLASS=\"petit_ville\">Sujet</font></BR><input type=\"text\" name=\"sujet\" size=\"30\" maxlength=\"50\" value=\"$sujet\"><BR><BR>";


$PAGE.="<textarea name=\"message\" cols=\"30\" rows=\"12\" CLASS=\"TEXTAREA\" id=\"message\">$message</textarea>";
          
          
    $PAGE.=" <br>
          <input name=\"mode\" type=\"hidden\" id=\"mode\" value=\"send\">
          <input name=\"user\" type=\"hidden\" id=\"user\" value=\"$_PERSO_ID\">
	      <input name=\"userid\" type=\"hidden\" id=\"userid\" value=\"0\">
          

          <BR><input type=\"submit\" name=\"Submit\" value=\"Envoyer\"><CENTER>
        </form>
      </div></td>
  </tr>
</table></CENTER>";


//mysql_close();
ECHO $PAGE;
EXIT;









?>

